package com.sunwayworld.basemodule.samplemanage.samplehandle.resource.impl;

import com.alibaba.fastjson.JSONObject;
import com.sunwayworld.basemodule.samplemanage.samplehandle.validators.LimsSampleHandleSubmitValidator;
import com.sunwayworld.framework.validator.data.annotation.ValidateDataWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.sunwayworld.basemodule.samplemanage.samplehandle.resource.LimsSampleHandleResource;
import com.sunwayworld.basemodule.samplemanage.samplehandle.service.LimsSampleHandleService;
import com.sunwayworld.framework.spring.annotation.GikamBean;
import com.sunwayworld.framework.log.annotation.Log;
import com.sunwayworld.framework.log.annotation.LogModule;
import com.sunwayworld.framework.log.annotation.LogType;
import com.sunwayworld.framework.restful.data.RestJsonWrapperBean;

@LogModule("样本处置表")
@RestController
@GikamBean
public class LimsSampleHandleResourceImpl implements LimsSampleHandleResource {

    @Autowired
    private LimsSampleHandleService limsSampleHandleService;

    @Override
    public LimsSampleHandleService getService() {
        return limsSampleHandleService;
    }

    @Log(value = "新增样本处置表", type = LogType.INSERT)
    @Override
    @RequestMapping(method = RequestMethod.POST)
    public Long insert(RestJsonWrapperBean wrapper) {
        return getService().insert(wrapper);
    }

    @Override
    public void addSample(RestJsonWrapperBean wrapper) {
        getService().addSample(wrapper);
    }

    @Override
    public void deleteSample(RestJsonWrapperBean wrapper) {
        getService().deleteSample(wrapper);
    }

    @Override
    public JSONObject checkSampleLocations(RestJsonWrapperBean wrapper) {
        return getService().checkSampleLocations(wrapper);
    }

    @ValidateDataWith(LimsSampleHandleSubmitValidator.class)
    @Override
    public void startProcess(RestJsonWrapperBean wrapper) {
        getService().startProcess(wrapper);
    }
}
